<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="request"/>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="<c:url value='/resources/styles/main.css' />" type="text/css"/>
    <script type="text/javascript">
        var contextPath = '${ctx}/';
        function deleteDate(id){

            if(window.confirm("确定要删除吗？"))
            {
                window.location.href=contextPath+'/admin/delNotification.do?id='+id;
            }

            <%----%>
        }
    </script>
    <title>消息推送列表</title>
</head>
<body>
<table class="header">
    <tr>
        <td>
            <h1>以发送消息列表</h1>
        </td>
    </tr>
</table>
<table class="pagination" style="padding-left: 70px;">
    <tr>
        <td>
            <a href="<c:url value="/admin/addNotification.do" />">新增消息</a>
        </td>
    </tr>
</table>

<table class="list">
    <tr>
        <%--<th>--%>
            <%--<input type="checkbox" class="checkAllItem" onclick="checkAllItem();" />--%>
        <%--</th>--%>
        <th >标题</th>
        <th >消息内容</th>
        <th >立即发送</th>
        <th >计划发送时间</th>
        <th >实际发送时间</th>
        <th >图片</th>
        <th >创建时间</th>
        <th >删除</th>
    </tr>
    <c:choose>
        <c:when test="${totalCount > 0}">
            <c:forEach var="item" items="${results}">
                <tr>
                    <%--<td><input type="checkbox" class="itemId" value="${item.id}" /></td>--%>

                    <%--<td>${item.id}</td>--%>
                    <td  width="10%">${item.title}</td>
                    <td width="50%">${item.msg}</td>

                        <td >${item.sendNow}</td>
                        <td >${item.planSendTime}</td>
                        <td >${item.actualSendTime}</td>
                    <%--<td>${item.picPath}</td>--%>
                    <td width="25%"><img src="${link}${item.picPath}" width="201px" height="138px" alt="没有图片"/></td>

                    <td  width="10%">
                            <%--${item.entryDate}--%>
                       <fmt:formatDate value="${item.entryD}" pattern="yyyy-MM-dd"/>
                    </td>
                        <td width="5%">
                            <%--<a href="<c:url value='/admin/delNotification.do?id=${item.id}' />">删除</a>--%>
                            <a href="#" onclick="deleteDate('${item.id}')">删除</a>
                    </td>
                </tr>
            </c:forEach>
                <tr>
                    <td colspan="17"><div class="pagination">${dataWrap.pagination}</div></td>
                </tr>
        </c:when>
        <c:otherwise>
            <tr>
                <td colspan="17">没有已发送消息数据</td>
            </tr>
        </c:otherwise>
    </c:choose>

</table>
</body>
</html>